﻿
@{
    ViewData["Title"] = "MinioTest";
    Layout = "~/Views/Shared/Template.cshtml";
}

<h2>MinIO断点续传</h2>
<input type="file" id="fileInput" />
<button onclick="uploadFile()">上传文件</button>
<progress id="uploadProgress" value="0" max="100"></progress>
<script>
    function uploadFile() {
        var fileInput = document.getElementById('fileInput');
        var file = fileInput.files[0];
        var xhr = new XMLHttpRequest();
        xhr.open('POST', '/Home/Upload', true);
        xhr.upload.onprogress = function (e) {
            if (e.lengthComputable) {
                var percentComplete = (e.loaded / e.total) * 100;
                document.getElementById('uploadProgress').value = percentComplete;
            }
        };
        var formData = new FormData();
        formData.append('file', file);
        xhr.send(formData);
    }
</script>

